# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file '获取SpinBox中的数字.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
import sys
from PySide2 import QtWidgets


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")
        self.spinBox = QSpinBox(self.centralwidget)
        self.spinBox.setObjectName(u"spinBox")
        self.spinBox.setGeometry(QRect(270, 180, 221, 61))

        # 设置 SpinBox的最小值和最大值以及调节的步长
        self.spinBox.setMinimum(0)
        self.spinBox.setMaximum(100)
        self.spinBox.setSingleStep(3)

        # 对spinbox设置信号与槽
        self.spinBox.valueChanged.connect(self.getvalue)

        self.label = QLabel(self.centralwidget)
        self.label.setObjectName(u"label")
        self.label.setGeometry(QRect(270, 300, 211, 31))
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 800, 26))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)
    # setupUi

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"\u83b7\u53d6SpinBox\u4e2d\u9009\u62e9\u7684\u6570\u5b57", None))
        self.label.setText(QCoreApplication.translate("MainWindow", u"\u6570\u503c\u663e\u793a\u533a\u57df", None))

    # 定义spinbox的槽函数
    def getvalue(self):
        self.label.setText(str(f"Spinbox中显示的数值为：{self.spinBox.value()}"))
    # retranslateUi


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

